package com.lzb.permanentcalendar.adapter;

import android.graphics.Color;
import android.view.View;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.lzb.permanentcalendar.R;
import com.lzb.permanentcalendar.basic.ProviderMultiAdapter;
import com.nlf.calendar.Solar;

import java.util.Date;

public class AgeAdapter extends ProviderMultiAdapter<Integer> {

    public AgeAdapter() {
        addItemProvider(new FestivalProvider());
    }

    private class FestivalProvider extends BaseItemProvider<Integer> {
        @Override
        public int getItemViewType() {
            return ProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_sx;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, Integer bean) {
            baseViewHolder.setText(R.id.tvSxItemYear, bean + "");
            Solar solar = Solar.fromDate(new Date());
            baseViewHolder.setText(R.id.tvSxItemAge, (solar.getYear() - bean) + "岁");
        }
    }

}
